<!-- templates/admin/users.html -->
{% extends "base.html" %}

{% block title %}用户管理 - 校园摄影投票系统{% endblock %}

{% block content %}
    <div class="container-fluid">
        <h1 class="mt-4">用户管理</h1>
        
        <div class="card shadow mb-4">
            <div class="card-header py-3">
                <h6 class="m-0 font-weight-bold text-primary">所有用户 ({{ users|length }})</h6>
            </div>
            <div class="card-body">
                <div class="table-responsive">
                    <table class="table table-bordered">
                        <thead>
                            <tr>
                                <th>ID</th>
                                <th>用户名</th>
                                <th>邮箱</th>
                                <th>注册时间</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            {% for user in users %}
                            <tr>
                                <td>{{ user.id }}</td>
                                <td>{{ user.username }}</td>
                                <td>{{ user.email }}</td>
                                <td>{{ user.created_at.strftime('%Y-%m-%d %H:%M') }}</td>
                                <td>
                                    <a href="{{ url_for('main.user_profile', username=user.username) }}" 
                                       class="btn btn-sm btn-info">查看</a>
                                    {% if user.is_admin %}
                                    <span class="badge bg-warning text-dark">管理员</span>
                                    {% endif %}
                                </td>
                            </tr>
                            {% endfor %}
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
{% endblock %}